﻿using System.Reflection;
using System;

namespace docNET.Common
{
	/// <summary>
	/// Internal helper class.
	/// </summary>
	internal static class Helper
	{
		/// <summary>
		/// Returns the application name.
		/// </summary>
		/// <returns></returns>
		internal static string GetAppName()
		{
			return Assembly.GetEntryAssembly().GetName().Name;
		}

		/// <summary>
		/// Returns the application name.
		/// </summary>
		/// <param name="withVersion">Include version information.</param>
		/// <returns></returns>
		internal static string GetAppName(bool withVersion)
		{
			if (withVersion)
				return string.Format("{0} {1}", GetAppName(), GetAppVersion());

			return GetAppName();
		}

		internal static string GetAppVersion()
		{
			Version v = Assembly.GetEntryAssembly().GetName().Version;
			return string.Format("{0}.{1}.{2}.{3}", v.Major, v.Minor, v.Build, v.Revision);
		}
	}
}
